# -*- coding: utf-8 -*-

a = 'part'
print a.isdigit() #是否为数字

b = '23-11'
print eval(b) #计算值

#字典
h = {'key': 12, 'nyckel': 'word'}
print h.has_key('key')
h.get('key', 'unknown')


#函数
def wangjl(r):                           # 函数定义
    "Check that all values in list r are positive."  # 文档字符串
    for i in r:
        if i <= 0: return False                      # 返回结果


#测试一个带默认值的函数
def default(m, x, ai):
    "test"
    print type(m)
    print type(x)
    print type(ai)


sequences = [[1, 5, 6, -0.01], [0.01, 1, 2]]

for seq in sequences:
    if not wangjl(seq):                  # 调用函数
        print 'invalid: ', seq

default(x=10, ai='10', m=2)
